
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>向🐑</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta property="og:type" content="website">
<meta property="og:title" content="向🐑">
<meta property="og:url" content="https://kziwws.github.io/index.html">
<meta property="og:site_name" content="向🐑">
<meta property="og:locale" content="zh_CN">
<meta property="article:author" content="kziwws">
<meta name="twitter:card" content="summary">
  
    <link rel="alternative" href="/atom.xml" title="向🐑" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
<link rel="stylesheet" href="/css/style.css">

  <!--[if lt IE 9]><script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7/html5shiv.min.js"></script><![endif]-->
  <!--  -->
  
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?51e08434b847b38641d02f11be4eb143";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>


<meta name="generator" content="Hexo 4.2.1"></head>
<body>
<div id="container">
  <div id="wrap">
    <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">向🐑</a>
      </h1>
      
        <h2 id="subtitle-wrap">
          <a href="/" id="subtitle">一只站在树上的鸟，从来不害怕树枝突然折断，因为它相信的不是树枝，而是它自己的翅膀！</a>
        </h2>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">首页</a>
        
          <a class="main-nav-link" href="/tags/technology">编程技术</a>
        
          <a class="main-nav-link" href="/tags/poetry">诗</a>
        
          <a class="main-nav-link" href="/tags/life">生活随笔</a>
        
          <a class="main-nav-link" href="/archives">所有文章</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        
        
        <a href="javascript:;" class="popup-trigger nav-icon" id="nav-search-btn"></a>
        
      </nav>
      <div id="search-form-wrap">
        <form action="//www.baidu.com/baidu" method="get" accept-charset="utf-8" class="search-form">
          <input type="search" name="word" maxlength="20" class="search-form-input" placeholder="Search">
          <input type="submit" value="" class="search-form-submit">
          <input name=tn type=hidden value="bds">
          <input name=cl type=hidden value="3">
          <input name=ct type=hidden value="2097152">
          <input type="hidden" name="si" value="kziwws.github.io">
        </form>
      </div>
    </div>
  </div>
  <div class="local-search-inner"><div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <span id="icon-search"></span>
    </span>
    <span class="popup-btn-close">
      <span id="icon-close"></span>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off"
             placeholder="本地搜索..." spellcheck="false"
             type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div></div>
</header>



    <div class="outer">
      <section id="main">
  
    <article id="post-technology20251105090825" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2025/11/05/technology20251105090825/" class="article-date">
  <time datetime="2025-11-05T01:08:25.000Z" itemprop="datePublished">2025-11-05</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/cocosCreator/">cocosCreator</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2025/11/05/technology20251105090825/">Sudoku Game Privacy Policy_ Zero Personal Data Collection, Pure Gaming Experience</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h1 id="Sudoku-Game-Privacy-Policy-Zero-Personal-Data-Collection-Pure-Gaming-Experience"><a href="#Sudoku-Game-Privacy-Policy-Zero-Personal-Data-Collection-Pure-Gaming-Experience" class="headerlink" title="Sudoku Game Privacy Policy: Zero Personal Data Collection, Pure Gaming Experience"></a>Sudoku Game Privacy Policy: Zero Personal Data Collection, Pure Gaming Experience</h1><p><strong>Last Modified Date</strong>: November 5, 2025</p>
<h2 id="1-Introduction"><a href="#1-Introduction" class="headerlink" title="1. Introduction"></a>1. Introduction</h2><p>This privacy policy applies to the Sudoku game (hereinafter referred to as the “Game”) you are using. Our core commitment is: <strong>the Game does not collect any of your personal privacy information</strong> at any stage of your use. We prioritize protecting your data security and privacy rights, allowing you to enjoy the pure fun of Sudoku puzzles without worrying about personal information leakage.</p>
<h2 id="2-About-Us-amp-Contact-Information"><a href="#2-About-Us-amp-Contact-Information" class="headerlink" title="2. About Us &amp; Contact Information"></a>2. About Us &amp; Contact Information</h2><p>The operator of this Game is an individual developer. If you have any questions, concerns, or complaints regarding this privacy policy, data practices, or your rights, please feel free to contact us through the following channel:</p>
<ul>
<li>Email: <a href="mailto:ggb.chen@foxmail.com">ggb.chen@foxmail.com</a></li>
</ul>
<h2 id="3-Core-Privacy-Commitment-No-Personal-Data-Collection"><a href="#3-Core-Privacy-Commitment-No-Personal-Data-Collection" class="headerlink" title="3. Core Privacy Commitment: No Personal Data Collection"></a>3. Core Privacy Commitment: No Personal Data Collection</h2><p>We strictly adhere to the principle of “zero personal data collection.” During your use of the Game, we will <strong>never collect, store, or process any of your personal privacy information</strong>, including but not limited to:</p>
        
          <p class="article-more-link">
            <a href="/2025/11/05/technology20251105090825/#more">Read More</a>
          </p>
        
      
    </div>
    <footer class="article-footer">
      
        <a data-url="https://kziwws.github.io/2025/11/05/technology20251105090825/" data-id="cmhm05vy2007rp4jj6pdhh7ow" class="article-share-link" data-share="baidu" data-title="Sudoku Game Privacy Policy_ Zero Personal Data Collection, Pure Gaming Experience">分享到</a>
      

    
  <a href="https://kziwws.github.io/2025/11/05/technology20251105090825/#valine_thread" class="article-comment-link">评论</a>


      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/cocosCreator/" rel="tag">cocosCreator</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/technology/" rel="tag">technology</a></li></ul>

    </footer>
  </div>
  
</article>

  
    <article id="post-technology20230910111821" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2023/09/10/technology20230910111821/" class="article-date">
  <time datetime="2023-09-10T03:18:21.000Z" itemprop="datePublished">2023-09-10</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2023/09/10/technology20230910111821/">Hexo博客部署常见问题及解决方案</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>在使用 Hexo 部署博客的过程中，常会遇到各种报错。本文整理了从 Node.js 版本兼容到 SSH 密钥配置的全套解决方案，帮助你快速排查并解决问题。</p>
<h2 id="一、环境准备与依赖修复"><a href="#一、环境准备与依赖修复" class="headerlink" title="一、环境准备与依赖修复"></a>一、环境准备与依赖修复</h2><h3 id="1-清除缓存与修复依赖"><a href="#1-清除缓存与修复依赖" class="headerlink" title="1. 清除缓存与修复依赖"></a>1. 清除缓存与修复依赖</h3><p>若部署时出现未知错误（如文件复制失败、模块缺失），优先修复依赖：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 清除 Hexo 缓存</span></span><br><span class="line">hexo clean</span><br><span class="line"></span><br><span class="line"><span class="comment"># 删除损坏的依赖文件和锁文件</span></span><br><span class="line">rm -rf node_modules package-lock.json yarn.lock</span><br><span class="line"></span><br><span class="line"><span class="comment"># 重新安装依赖</span></span><br><span class="line">npm install</span><br></pre></td></tr></table></figure>

<h3 id="2-安装-Node-版本管理工具（nvm）"><a href="#2-安装-Node-版本管理工具（nvm）" class="headerlink" title="2. 安装 Node 版本管理工具（nvm）"></a>2. 安装 Node 版本管理工具（nvm）</h3><p>Hexo 对 Node.js 版本有严格要求（推荐 v14.0.0+，旧主题建议 v16 LTS），使用 nvm 可灵活切换版本。</p>
<h4 id="国内镜像安装（解决-GitHub-访问受限）："><a href="#国内镜像安装（解决-GitHub-访问受限）：" class="headerlink" title="国内镜像安装（解决 GitHub 访问受限）："></a>国内镜像安装（解决 GitHub 访问受限）：</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 用 Gitee 镜像安装 nvm（速度更快）</span></span><br><span class="line">curl -o- https://gitee.com/mirrors/nvm/raw/v0.39.3/install.sh | bash</span><br></pre></td></tr></table></figure>

<h4 id="加载-nvm-配置（立即生效）："><a href="#加载-nvm-配置（立即生效）：" class="headerlink" title="加载 nvm 配置（立即生效）："></a>加载 nvm 配置（立即生效）：</h4><p>安装后关闭终端重开，或手动加载配置：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">export</span> NVM_DIR=<span class="string">"<span class="variable">$HOME</span>/.nvm"</span></span><br><span class="line">[ -s <span class="string">"<span class="variable">$NVM_DIR</span>/nvm.sh"</span> ] &amp;&amp; \. <span class="string">"<span class="variable">$NVM_DIR</span>/nvm.sh"</span>  <span class="comment"># 加载 nvm 核心脚本</span></span><br></pre></td></tr></table></figure>
        
          <p class="article-more-link">
            <a href="/2023/09/10/technology20230910111821/#more">Read More</a>
          </p>
        
      
    </div>
    <footer class="article-footer">
      
        <a data-url="https://kziwws.github.io/2023/09/10/technology20230910111821/" data-id="cmhm05vy3007vp4jj7zgs2xzs" class="article-share-link" data-share="baidu" data-title="Hexo博客部署常见问题及解决方案">分享到</a>
      

    
  <a href="https://kziwws.github.io/2023/09/10/technology20230910111821/#valine_thread" class="article-comment-link">评论</a>


      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/hexo/" rel="tag">hexo</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/technology/" rel="tag">technology</a></li></ul>

    </footer>
  </div>
  
</article>

  
    <article id="post-technology20230314101225" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2023/03/14/technology20230314101225/" class="article-date">
  <time datetime="2023-03-14T02:12:25.000Z" itemprop="datePublished">2023-03-14</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/cocosCreator/">cocosCreator</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2023/03/14/technology20230314101225/">利用python脚本拆解游戏中的图集资源</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>如何使用Python对图集进行裁剪并保存，以便在开发游戏、UI设计等领域中使用。</p>
<p>以下是具体的步骤：</p>
<p>在运行这个脚本之前，需要确保你的Python环境中已经安装了以下库：</p>
<p><code>Pillow</code>：用于图像处理和操作，可以通过<code>pip install Pillow</code>命令进行安装；</p>
<p><code>biplist</code>：用于读取和写入plist文件，可以通过<code>pip install biplist</code>命令进行安装。</p>
<h4 id="准备文件路径参数"><a href="#准备文件路径参数" class="headerlink" title="准备文件路径参数"></a>准备文件路径参数</h4><p>首先需要准备好图集和plist文件的路径，以及裁剪后图片保存的路径。</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">plist_path = <span class="string">'/Users/您的电脑名字/Desktop/yuobm/map.plist'</span></span><br><span class="line">img_path = <span class="string">'/Users/您的电脑名字/Desktop/yuobm/map.png'</span></span><br><span class="line">save_path = <span class="string">'/Users/您的电脑名字/Desktop/yuobm/frames'</span></span><br></pre></td></tr></table></figure>

<h4 id="加载图集信息"><a href="#加载图集信息" class="headerlink" title="加载图集信息"></a>加载图集信息</h4><p>使用<code>biplist</code>库读取plist文件，并获取图集文件名。</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">with</span> open(plist_path, <span class="string">'rb'</span>) <span class="keyword">as</span> fp:</span><br><span class="line">    root = biplist.readPlist(fp)</span><br><span class="line">file_name = img_path</span><br><span class="line">image = Image.open(file_name)</span><br></pre></td></tr></table></figure>

<h4 id="遍历所有图片信息并裁剪保存"><a href="#遍历所有图片信息并裁剪保存" class="headerlink" title="遍历所有图片信息并裁剪保存"></a>遍历所有图片信息并裁剪保存</h4><p>循环遍历所有图片信息，获取当前图片的名称和信息，并根据信息进行裁剪并保存。</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">for</span> image_info <span class="keyword">in</span> root[<span class="string">'frames'</span>]:</span><br><span class="line">    image_name = os.path.splitext(image_info)[<span class="number">0</span>] + <span class="string">".png"</span></span><br><span class="line">    info = root[<span class="string">'frames'</span>][image_info][<span class="string">'frame'</span>]</span><br><span class="line">    </span><br><span class="line">    frame_str = info</span><br><span class="line">    x = int(frame_str[<span class="number">2</span>:frame_str.index(<span class="string">','</span>, <span class="number">2</span>)])</span><br><span class="line">    y = int(frame_str[frame_str.index(<span class="string">','</span>, <span class="number">2</span>) + <span class="number">1</span>:frame_str.index(<span class="string">'&#125;'</span>, <span class="number">2</span>)])</span><br><span class="line">    width = int(frame_str[frame_str.rindex(<span class="string">'&#123;'</span>) + <span class="number">1</span>:frame_str.rindex(<span class="string">','</span>, frame_str.rindex(<span class="string">'&#123;'</span>))])</span><br><span class="line">    height = int(frame_str[frame_str.rindex(<span class="string">','</span>) + <span class="number">1</span>:<span class="number">-2</span>])</span><br><span class="line"></span><br><span class="line">    rotated = root[<span class="string">'frames'</span>][image_info].get(<span class="string">'rotated'</span>, <span class="literal">False</span>)</span><br><span class="line">    <span class="keyword">if</span> rotated:</span><br><span class="line">        crop_image = image.crop((x, y, x + height, y + width))</span><br><span class="line">        crop_image = crop_image.transpose(Image.ROTATE_90)</span><br><span class="line">    <span class="keyword">else</span>:</span><br><span class="line">        crop_image = image.crop((x, y, x + width, y + height))</span><br><span class="line"></span><br><span class="line">    save_file = os.path.join(save_path, image_name)</span><br><span class="line">    crop_image.save(save_file)</span><br></pre></td></tr></table></figure>
        
          <p class="article-more-link">
            <a href="/2023/03/14/technology20230314101225/#more">Read More</a>
          </p>
        
      
    </div>
    <footer class="article-footer">
      
        <a data-url="https://kziwws.github.io/2023/03/14/technology20230314101225/" data-id="cmhm05vy1007hp4jjg6og20q8" class="article-share-link" data-share="baidu" data-title="利用python脚本拆解游戏中的图集资源">分享到</a>
      

    
  <a href="https://kziwws.github.io/2023/03/14/technology20230314101225/#valine_thread" class="article-comment-link">评论</a>


      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/cocosCreator/" rel="tag">cocosCreator</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/technology/" rel="tag">technology</a></li></ul>

    </footer>
  </div>
  
</article>

  
    <article id="post-technology20230210090112" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2023/02/10/technology20230210090112/" class="article-date">
  <time datetime="2023-02-10T01:01:12.000Z" itemprop="datePublished">2023-02-10</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/ios/">ios</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2023/02/10/technology20230210090112/">利用jekenis自动打包上传阿里云下载和通知钉钉机器人</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h5 id="利用jekenis自动打包、上传阿里云OSS生成二维码下载链接、通知钉钉机器人发送打包信息。"><a href="#利用jekenis自动打包、上传阿里云OSS生成二维码下载链接、通知钉钉机器人发送打包信息。" class="headerlink" title="利用jekenis自动打包、上传阿里云OSS生成二维码下载链接、通知钉钉机器人发送打包信息。"></a>利用jekenis自动打包、上传阿里云OSS生成二维码下载链接、通知钉钉机器人发送打包信息。</h5><p>前面介绍了单项目打包，和多项目打包，<a href="https://kziwws.github.io/2023/01/20/technology20230120161001/">IOS项目单独打包 </a>、<a href="https://kziwws.github.io/2023/01/21/technology20230121151206/">IOS脚本批量打包</a>。<br>现在在单独打包的基础上增加一些功能：</p>
<blockquote>
<p>打包完成过后，自动生成Plists文件上传到阿里云OSS, itms-services:// URL,这个 URL 是 iOS 应用程序安装包的协议格式，而不是 HTTP 或 HTTPS 协议格式的链接。<br>利用ossutil上传IPA包到阿里云OSS过后，然后利用qrserver服务生成QR二维码，同样子上传到阿里云。<br>使用markdown语法再转发生成的二维码链接直接下载。</p>
</blockquote>
<ul>
<li><a href="#ios_jekenis">mac安装jekenis</a></li>
<li><a href="#ios_xcodebuild">ios项目xcodebuild打包</a></li>
<li><a href="#ios_uploadl_ipa">ipa包上传阿里云OSS</a></li>
<li><a href="#ios_plist">生成下载需要的Plist文件</a></li>
<li><a href="#ios_upload_qr">生成二维码并上传</a></li>
<li><a href="#ios_ding">通知钉钉发送打包消息</a></li>
</ul>
<p><a name='ios_jekenis'><strong>一、mac安装jekenis</strong></a></p>
<h5 id="安装地址-https-www-jenkins-io-download-lts-macos"><a href="#安装地址-https-www-jenkins-io-download-lts-macos" class="headerlink" title="安装地址   https://www.jenkins.io/download/lts/macos/"></a>安装地址   <a href="https://www.jenkins.io/download/lts/macos/" target="_blank" rel="noopener">https://www.jenkins.io/download/lts/macos/</a></h5><p><code>brew install jenkins-lts</code> 安装最近最新的一次版本</p>
<p><code>brew install jenkins-lts@YOUR_VERSION</code> 安装对应的其他版本</p>
<p>如果遇到 </p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">Error1：brew install jenkins Error: The following directories are not writable by your user</span><br><span class="line">在终端执行:</span><br><span class="line">sudo chown -R whoami:admin /usr/<span class="built_in">local</span>/bin</span><br><span class="line">sudo chown -R whoami:admin /usr/<span class="built_in">local</span>/share</span><br><span class="line"></span><br><span class="line">Error2：遇到其他位置问题，重新安装一下最新的Homebrew</span><br><span class="line">可参考地址 https://www.cnblogs.com/somepark/p/16813250.html</span><br><span class="line"></span><br><span class="line">在Terminal 执行 /bin/zsh -c <span class="string">"<span class="variable">$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)</span>"</span>，</span><br><span class="line">这里最好选择第2个源，清华大学下载源。然后根据提示安装</span><br></pre></td></tr></table></figure>

<p>以上安装完成 在重新<code>brew install jenkins-lts</code>执行下载安装 jenkins，如果失败，请选网络或者重试。</p>
<h5 id="运行Jenkins"><a href="#运行Jenkins" class="headerlink" title="运行Jenkins"></a>运行Jenkins</h5><p><code>brew services start jenkins-lts</code> 开启jenkins</p>
<p><code>brew services restart jenkins-lts</code> 重启命令</p>
<p><a name='ios_xcodebuild'><strong>二、ios项目xcodebuild打包</strong></a></p>
<p>• 编译前清理工程：</p>
<p> <code>xcodebuild clean -project ${projectName}.xcodeproj</code>。</p>
<p>• 获取项目工程名：</p>
<p><code>find . -name *.xcodeproj | awk -F &quot;[/.]&quot; &#39;{print $(NF-1)}</code> 中获取。</p>
<p>• 获取打包AdHoc、AppStore、Enterprise、Development 所需的plist目录，这个目录在打包脚本的目录里。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 判读用户打包类型</span></span><br><span class="line">packType=<span class="variable">$&#123;PackageType&#125;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">"33[31m 打包参数值:<span class="variable">$&#123;packType&#125;</span> n 33[0m"</span></span><br><span class="line"><span class="keyword">if</span> [ <span class="variable">$packType</span> == <span class="string">"AdHoc"</span> ] ; <span class="keyword">then</span></span><br><span class="line">exportOptionsPlistPath=<span class="string">"<span class="variable">$&#123;plistPath&#125;</span>/AdHocExportOptionsPlist.plist"</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">"当前选择构建AdHoc"</span></span><br><span class="line"><span class="keyword">elif</span> [ <span class="variable">$packType</span> == <span class="string">"AppStore"</span> ] ; <span class="keyword">then</span></span><br><span class="line">exportOptionsPlistPath=<span class="string">"<span class="variable">$&#123;plistPath&#125;</span>/AppStoreExportOptionsPlist.plist"</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">"当前选择构建AppStore"</span></span><br><span class="line"><span class="keyword">elif</span> [ <span class="variable">$packType</span> == <span class="string">"Enterprise"</span> ] ; <span class="keyword">then</span></span><br><span class="line">exportOptionsPlistPath=<span class="string">"<span class="variable">$&#123;plistPath&#125;</span>/EnterpriseExportOptionsPlist.plist"</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">"当前选择构建Enterprise"</span></span><br><span class="line"><span class="keyword">elif</span> [ <span class="variable">$packType</span> == <span class="string">"Development"</span> ] ; <span class="keyword">then</span></span><br><span class="line">exportOptionsPlistPath=<span class="string">"<span class="variable">$&#123;plistPath&#125;</span>/DevelopmentExportOptionsPlist.plist"</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">"当前选择构建Development"</span></span><br><span class="line"><span class="keyword">else</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">"参数无效!!!"</span></span><br><span class="line"><span class="built_in">exit</span> 1</span><br><span class="line"><span class="keyword">fi</span></span><br></pre></td></tr></table></figure>

<p>• 执行xcodebuild打包IPA。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># Build 生成 APP</span></span><br><span class="line"><span class="comment"># 判断编译的项目类型是workspace还是project</span></span><br><span class="line"><span class="keyword">if</span> <span class="variable">$is_workspace</span> ; <span class="keyword">then</span></span><br><span class="line"><span class="comment"># 编译前清理工程</span></span><br><span class="line">xcodebuild clean -workspace <span class="variable">$&#123;projectName&#125;</span>.xcworkspace \</span><br><span class="line">                 -scheme <span class="variable">$&#123;schemeName&#125;</span> \</span><br><span class="line">                 -configuration <span class="variable">$&#123;build_configuration&#125;</span></span><br><span class="line">xcodebuild archive -workspace <span class="variable">$&#123;projectName&#125;</span>.xcworkspace \</span><br><span class="line">                   -scheme <span class="variable">$&#123;schemeName&#125;</span> \</span><br><span class="line">                   -configuration <span class="variable">$&#123;build_configuration&#125;</span> \</span><br><span class="line">                   -archivePath <span class="variable">$&#123;buildDir&#125;</span> \</span><br><span class="line">                   -destination <span class="string">'generic/platform=iOS'</span> \</span><br><span class="line">                   -quiet</span><br><span class="line"><span class="keyword">else</span></span><br><span class="line"><span class="comment"># 编译前清理工程</span></span><br><span class="line">xcodebuild clean -project <span class="variable">$&#123;projectName&#125;</span>.xcodeproj \</span><br><span class="line">                 -scheme <span class="variable">$&#123;schemeName&#125;</span> \</span><br><span class="line">                 -configuration <span class="variable">$&#123;build_configuration&#125;</span></span><br><span class="line">xcodebuild archive -project <span class="variable">$&#123;projectName&#125;</span>.xcodeproj \</span><br><span class="line">                   -scheme <span class="variable">$&#123;schemeName&#125;</span> \</span><br><span class="line">                   -configuration <span class="variable">$&#123;build_configuration&#125;</span> \</span><br><span class="line">                   -archivePath <span class="variable">$&#123;buildDir&#125;</span> \</span><br><span class="line">                   -destination <span class="string">'generic/platform=iOS'</span> \</span><br><span class="line">                   -quiet</span><br><span class="line"><span class="comment"># 生成 ipa</span></span><br><span class="line">xcodebuild -exportArchive \</span><br><span class="line">  -archivePath <span class="variable">$&#123;buildDir&#125;</span> \</span><br><span class="line">  -exportOptionsPlist <span class="variable">$&#123;exportOptionsPlistPath&#125;</span> \</span><br><span class="line">  -exportPath <span class="variable">$&#123;ipaPath&#125;</span> \</span><br><span class="line">  -allowProvisioningUpdates <span class="variable">$&#123;YES&#125;</span> \</span><br><span class="line">  -allowProvisioningDeviceRegistration <span class="variable">$&#123;YES&#125;</span> \</span><br></pre></td></tr></table></figure>
        
          <p class="article-more-link">
            <a href="/2023/02/10/technology20230210090112/#more">Read More</a>
          </p>
        
      
    </div>
    <footer class="article-footer">
      
        <a data-url="https://kziwws.github.io/2023/02/10/technology20230210090112/" data-id="cmhm05vy3007zp4jj8fqf0j9z" class="article-share-link" data-share="baidu" data-title="利用jekenis自动打包上传阿里云下载和通知钉钉机器人">分享到</a>
      

    
  <a href="https://kziwws.github.io/2023/02/10/technology20230210090112/#valine_thread" class="article-comment-link">评论</a>


      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/ios/" rel="tag">ios</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/technology/" rel="tag">technology</a></li></ul>

    </footer>
  </div>
  
</article>

  
    <article id="post-technology20230121151206" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2023/01/21/technology20230121151206/" class="article-date">
  <time datetime="2023-01-21T07:12:06.000Z" itemprop="datePublished">2023-01-21</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/ios/">ios</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2023/01/21/technology20230121151206/">IOS项目脚本自动化批量打包并上传第三方平台</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h5 id="由于公司项目需求然后想要一个项目打包多个包，然后app名字、bundleId、服务器连接URL、appIocn、app项目内容渠道参数不一样，针对网上看了一些教程和方式，现在总结一下。"><a href="#由于公司项目需求然后想要一个项目打包多个包，然后app名字、bundleId、服务器连接URL、appIocn、app项目内容渠道参数不一样，针对网上看了一些教程和方式，现在总结一下。" class="headerlink" title="由于公司项目需求然后想要一个项目打包多个包，然后app名字、bundleId、服务器连接URL、appIocn、app项目内容渠道参数不一样，针对网上看了一些教程和方式，现在总结一下。"></a>由于公司项目需求然后想要一个项目打包多个包，然后app名字、bundleId、服务器连接URL、appIocn、app项目内容渠道参数不一样，针对网上看了一些教程和方式，现在总结一下。</h5><p>如果想要知道单个项目脚本打包请查看<a href="https://kziwws.github.io/2023/01/20/technology20230120161001/">IOS脚本单独打包</a></p>
<h5 id="一、bash脚本"><a href="#一、bash脚本" class="headerlink" title="一、bash脚本"></a><strong>一、bash脚本</strong></h5><p>bash 是一个用 C 语言编写的程序，它是用户使用 Linux 的桥梁。bash 既是一种命令语言，又是一种程序设计语言。<a href="https://www.runoob.com/linux/linux-bash.html" target="_blank" rel="noopener">bash脚本基础学习</a></p>
<p><strong>项目目录结构</strong></p>
<p><a href="https://imgse.com/i/pp97uJs" target="_blank" rel="noopener"><img src="https://s1.ax1x.com/2023/02/27/pp97uJs.png" alt="pp97uJs.png"></a></p>
<p><strong>结构说明：</strong></p>
<p>MutaPackageScript.sh : 为脚本文件 (批量时部分配置修改)</p>
<p>Plist：为打包4种打包模式 AdHoc、AppStore、Development、Enterprise （不需要动）</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</span></span><br><span class="line"><span class="meta">&lt;!DOCTYPE <span class="meta-keyword">plist</span> <span class="meta-keyword">PUBLIC</span> <span class="meta-string">"-//Apple//DTD PLIST 1.0//EN"</span> <span class="meta-string">"http://www.apple.com/DTDs/PropertyList-1.0.dtd"</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">plist</span> <span class="attr">version</span>=<span class="string">"1.0"</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">dict</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">key</span>&gt;</span>method<span class="tag">&lt;/<span class="name">key</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">string</span>&gt;</span>development<span class="tag">&lt;/<span class="name">string</span>&gt;</span>//这儿development、enterprise、ad-hoc、app-store四种</span><br><span class="line">	<span class="tag">&lt;<span class="name">key</span>&gt;</span>signingStyle<span class="tag">&lt;/<span class="name">key</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">string</span>&gt;</span>automatic<span class="tag">&lt;/<span class="name">string</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">key</span>&gt;</span>compileBitcode<span class="tag">&lt;/<span class="name">key</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">false</span>/&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">dict</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">plist</span>&gt;</span></span><br></pre></td></tr></table></figure>
        
          <p class="article-more-link">
            <a href="/2023/01/21/technology20230121151206/#more">Read More</a>
          </p>
        
      
    </div>
    <footer class="article-footer">
      
        <a data-url="https://kziwws.github.io/2023/01/21/technology20230121151206/" data-id="cmhm05vy2007jp4jjhw2sc7ch" class="article-share-link" data-share="baidu" data-title="IOS项目脚本自动化批量打包并上传第三方平台">分享到</a>
      

    
  <a href="https://kziwws.github.io/2023/01/21/technology20230121151206/#valine_thread" class="article-comment-link">评论</a>


      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/ios/" rel="tag">ios</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/technology/" rel="tag">technology</a></li></ul>

    </footer>
  </div>
  
</article>

  
    <article id="post-technology20230120161001" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2023/01/20/technology20230120161001/" class="article-date">
  <time datetime="2023-01-20T08:10:01.000Z" itemprop="datePublished">2023-01-20</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/ios/">ios</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2023/01/20/technology20230120161001/">IOS项目单独脚本自动化打包</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h5 id="通过脚本自动化打包IOS项目"><a href="#通过脚本自动化打包IOS项目" class="headerlink" title="通过脚本自动化打包IOS项目"></a>通过脚本自动化打包IOS项目</h5><p>如果想要单个包批量打包请查看<a href="https://kziwws.github.io/2023/01/21/technology20230121151206/">IOS脚本批量打包</a></p>
<h5 id="一、Shell脚本"><a href="#一、Shell脚本" class="headerlink" title="一、Shell脚本"></a><strong>一、Shell脚本</strong></h5><p>Shell 是一个用 C 语言编写的程序，它是用户使用 Linux 的桥梁。Shell 既是一种命令语言，又是一种程序设计语言。<a href="https://www.runoob.com/linux/linux-shell.html" target="_blank" rel="noopener">shell脚本基础学习</a></p>
<p>在终端输入man xcodebuild，可以看到Description里面有介绍用法。<br><a href="https://www.cnblogs.com/drewgg/p/15785467.html" target="_blank" rel="noopener">xcodebuild指令文档学习</a></p>
<p><strong>项目目录结构</strong></p>
<p><a href="https://imgse.com/i/pp9LgDP" target="_blank" rel="noopener"><img src="https://s1.ax1x.com/2023/02/27/pp9LgDP.png" alt="pp9LgDP.png"></a></p>
<p><strong>结构说明：</strong></p>
<p>SinglePackageScript.sh : 为脚本文件 (可不修改)</p>
<p>各个Plist：为打包4种打包模式 AdHoc、AppStore、Development、Enterprise （不需要动）</p>
        
          <p class="article-more-link">
            <a href="/2023/01/20/technology20230120161001/#more">Read More</a>
          </p>
        
      
    </div>
    <footer class="article-footer">
      
        <a data-url="https://kziwws.github.io/2023/01/20/technology20230120161001/" data-id="cmhm05vy1007cp4jj3b5yekz6" class="article-share-link" data-share="baidu" data-title="IOS项目单独脚本自动化打包">分享到</a>
      

    
  <a href="https://kziwws.github.io/2023/01/20/technology20230120161001/#valine_thread" class="article-comment-link">评论</a>


      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/ios/" rel="tag">ios</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/technology/" rel="tag">technology</a></li></ul>

    </footer>
  </div>
  
</article>

  
    <article id="post-technology20230106110520" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2023/01/06/technology20230106110520/" class="article-date">
  <time datetime="2023-01-06T03:05:20.000Z" itemprop="datePublished">2023-01-06</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/cocosCreator/">cocosCreator</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2023/01/06/technology20230106110520/">Hexo文章上传指令操作</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Hexo-博客从安装到本地预览-线上部署完整教程"><a href="#Hexo-博客从安装到本地预览-线上部署完整教程" class="headerlink" title="Hexo 博客从安装到本地预览+线上部署完整教程"></a>Hexo 博客从安装到本地预览+线上部署完整教程</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 1. 清理缓存</span></span><br><span class="line">hexo clean</span><br><span class="line"></span><br><span class="line"><span class="comment"># 2. 生成最新静态文件</span></span><br><span class="line">hexo g</span><br><span class="line"><span class="comment"># 3. 临时访问</span></span><br><span class="line">hexo s -p 3000  <span class="comment"># 访问地址：http://localhost:3000</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 4. 推送部署到 GitHub（核心命令）</span></span><br><span class="line">hexo d  <span class="comment"># 或 hexo deploy</span></span><br></pre></td></tr></table></figure>

<figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">本文详细记录 Hexo 博客的安装配置、本地预览及线上部署全流程，适用于 macOS（Apple 芯片）系统，Windows/Linux 可参考适配对应路径，新手可直接按步骤操作。</span><br><span class="line"></span><br><span class="line">一、前置准备</span><br><span class="line"></span><br><span class="line"><span class="bullet">1. </span>安装 Node.js</span><br><span class="line">Hexo 基于 Node.js 开发，需先安装 Node.js（自带 npm 包管理器）：</span><br><span class="line"><span class="bullet">- </span>下载地址：[<span class="string">Node.js 官网</span>](<span class="link">https://nodejs.org/</span>)</span><br><span class="line"><span class="bullet">- </span>安装要求：推荐下载 LTS 长期支持版（如 18.x 或 20.x），安装后自动配置环境变量</span><br><span class="line"><span class="bullet">- </span>验证安装：终端执行以下命令，输出版本号即成功</span><br><span class="line">  node -v  # 输出示例：v18.17.0</span><br><span class="line">  npm -v   # 输出示例：9.6.7</span><br></pre></td></tr></table></figure>

<h2 id=""><a href="#" class="headerlink" title=""></a></h2><h3 id="1-全局安装-Hexo-脚手架"><a href="#1-全局安装-Hexo-脚手架" class="headerlink" title="1. 全局安装 Hexo 脚手架"></a>1. 全局安装 Hexo 脚手架</h3><p>终端执行以下命令，全局安装 Hexo 核心工具：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install -g hexo-cli</span><br></pre></td></tr></table></figure>

<p>安装成功提示：</p>
<ul>
<li><pre><code class="plaintext">changed 53 packages in 686ms
14 packages are looking for funding
  run `npm fund` for details
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">### 2. 配置 zsh 环境变量（解决 &quot;command not found: hexo&quot;）</span><br><span class="line"></span><br><span class="line">安装后若终端提示找不到 hexo 命令，需配置环境变量（macOS Apple 芯片专属路径）：</span><br><span class="line"></span><br><span class="line">查看 npm 全局前缀路径（终端执行）：</span><br><span class="line"></span><br><span class="line">&#96;&#96;&#96;bash</span><br><span class="line">npm config get prefix</span><br></pre></td></tr></table></figure></code></pre>
</li>
<li><p>输出结果（Apple 芯片默认）：<code>/opt/homebrew</code></p>
</li>
</ul>
<p>编辑 zsh 配置文件：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 打开配置文件（无则自动创建）</span></span><br><span class="line">touch ~/.zshrc &amp;&amp; open ~/.zshrc</span><br></pre></td></tr></table></figure>

<p>在文件末尾添加以下内容（直接复制）：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">export</span> PATH=<span class="string">"/opt/homebrew/bin:<span class="variable">$PATH</span>"</span></span><br></pre></td></tr></table></figure>

<p>生效配置并验证：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 让配置立即生效</span></span><br><span class="line"><span class="built_in">source</span> ~/.zshrc</span><br><span class="line"></span><br><span class="line"><span class="comment"># 验证 Hexo 是否安装成功（输出版本号即成功）</span></span><br><span class="line">hexo -v</span><br></pre></td></tr></table></figure>

<ul>
<li>成功输出示例：</li>
</ul>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">hexo-cli: 4.3.0</span><br><span class="line">node: 18.17.0</span><br><span class="line">os: darwin arm64</span><br></pre></td></tr></table></figure>



<hr>
<h2 id="三、Hexo-本地预览操作"><a href="#三、Hexo-本地预览操作" class="headerlink" title="三、Hexo 本地预览操作"></a>三、Hexo 本地预览操作</h2><h3 id="1-初始化-Hexo-博客（首次操作）"><a href="#1-初始化-Hexo-博客（首次操作）" class="headerlink" title="1. 初始化 Hexo 博客（首次操作）"></a>1. 初始化 Hexo 博客（首次操作）</h3><ol>
<li>终端进入需存放博客的目录（如桌面）：</li>
</ol>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> ~/Desktop  <span class="comment"># 示例：进入桌面</span></span><br></pre></td></tr></table></figure>

<p>初始化博客文件夹（替换 <code>my-hexo-blog</code> 为自定义博客名）：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo init my-hexo-blog</span><br></pre></td></tr></table></figure>

<p>进入博客根目录：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> my-hexo-blog</span><br></pre></td></tr></table></figure>

<h3 id="2-本地预览核心命令（按顺序执行）"><a href="#2-本地预览核心命令（按顺序执行）" class="headerlink" title="2. 本地预览核心命令（按顺序执行）"></a>2. 本地预览核心命令（按顺序执行）</h3><p>所有命令需在 <strong>博客根目录</strong> 执行：</p>
<h4 id="（1）清理缓存（可选但推荐）"><a href="#（1）清理缓存（可选但推荐）" class="headerlink" title="（1）清理缓存（可选但推荐）"></a>（1）清理缓存（可选但推荐）</h4><p>清除旧版静态文件和缓存，避免冲突：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo clean</span><br></pre></td></tr></table></figure>

<ul>
<li>成功输出：<code>INFO  Deleted database.</code> <code>INFO  Deleted public folder.</code></li>
</ul>
<h4 id="（2）生成静态文件"><a href="#（2）生成静态文件" class="headerlink" title="（2）生成静态文件"></a>（2）生成静态文件</h4><p>将 Markdown 文章、主题模板编译为 HTML/CSS/JS 静态文件（生成到 <code>public</code> 文件夹）：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo g  <span class="comment"># 全称 hexo generate，简写 g 更便捷</span></span><br></pre></td></tr></table></figure>

<ul>
<li>成功输出：<code>INFO  Generated x pages</code>（x 为生成的页面数量）</li>
</ul>
<h4 id="（3）启动本地服务器"><a href="#（3）启动本地服务器" class="headerlink" title="（3）启动本地服务器"></a>（3）启动本地服务器</h4><p>启动内置服务器，实现本地预览：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo s  <span class="comment"># 全称 hexo server，简写 s</span></span><br></pre></td></tr></table></figure>

<p>成功输出：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">INFO  Start processing</span><br><span class="line">INFO  Hexo is running at http://localhost:4000 . Press Ctrl+C to stop.</span><br></pre></td></tr></table></figure>

<h3 id="3-本地预览访问"><a href="#3-本地预览访问" class="headerlink" title="3. 本地预览访问"></a>3. 本地预览访问</h3><p>打开浏览器，输入地址 <code>http://localhost:4000</code>，即可看到 Hexo 默认博客页面。</p>
<ul>
<li>实时预览：修改文章、配置或主题后，刷新浏览器即可看到更新</li>
<li>停止服务器：终端按 <code>Ctrl + C</code> 组合键</li>
</ul>
<h3 id="4-实用补充指令"><a href="#4-实用补充指令" class="headerlink" title="4. 实用补充指令"></a>4. 实用补充指令</h3><h4 id="（1）指定端口启动（避免端口占用）"><a href="#（1）指定端口启动（避免端口占用）" class="headerlink" title="（1）指定端口启动（避免端口占用）"></a>（1）指定端口启动（避免端口占用）</h4><p>若 4000 端口被占用，可指定其他端口（如 3000）：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo s -p 3000  <span class="comment"># 访问地址：http://localhost:3000</span></span><br></pre></td></tr></table></figure>

<h4 id="（2）一键执行清理-生成-启动"><a href="#（2）一键执行清理-生成-启动" class="headerlink" title="（2）一键执行清理 + 生成 + 启动"></a>（2）一键执行清理 + 生成 + 启动</h4><p>无需分步输入，用 <code>&amp;&amp;</code> 连接指令：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo clean &amp;&amp; hexo g &amp;&amp; hexo s</span><br></pre></td></tr></table></figure>

<h4 id="（3）调试模式启动（排查问题）"><a href="#（3）调试模式启动（排查问题）" class="headerlink" title="（3）调试模式启动（排查问题）"></a>（3）调试模式启动（排查问题）</h4><p>预览异常时，开启调试模式查看详细日志：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo s --debug</span><br></pre></td></tr></table></figure>

<hr>
<h2 id="四、Hexo-线上部署（hexo-d-命令使用）"><a href="#四、Hexo-线上部署（hexo-d-命令使用）" class="headerlink" title="四、Hexo 线上部署（hexo d 命令使用）"></a>四、Hexo 线上部署（<code>hexo d</code> 命令使用）</h2><p><code>hexo d</code> 是 <code>hexo deploy</code> 的简写，用于将本地静态文件推送到远程平台（如 GitHub Pages），实现线上访问。</p>
<h3 id="1-安装部署插件（必须）"><a href="#1-安装部署插件（必须）" class="headerlink" title="1. 安装部署插件（必须）"></a>1. 安装部署插件（必须）</h3><p>在博客根目录执行，安装 Git 部署插件：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo-deployer-git --save</span><br></pre></td></tr></table></figure>

<h3 id="2-配置远程部署平台（以-GitHub-Pages-为例）"><a href="#2-配置远程部署平台（以-GitHub-Pages-为例）" class="headerlink" title="2. 配置远程部署平台（以 GitHub Pages 为例）"></a>2. 配置远程部署平台（以 GitHub Pages 为例）</h3><h4 id="（1）准备-GitHub-仓库"><a href="#（1）准备-GitHub-仓库" class="headerlink" title="（1）准备 GitHub 仓库"></a>（1）准备 GitHub 仓库</h4><ol>
<li>登录 GitHub，新建仓库，仓库名必须为：<code>你的GitHub用户名.github.io</code>（如 <code>xxx.github.io</code>）</li>
<li>仓库页面点击「Code」，复制仓库 HTTPS/SSH 地址（如 <code>https://github.com/xxx/xxx.github.io.git</code>）</li>
</ol>
<h4 id="（2）配置-Hexo-部署信息"><a href="#（2）配置-Hexo-部署信息" class="headerlink" title="（2）配置 Hexo 部署信息"></a>（2）配置 Hexo 部署信息</h4><ol>
<li>打开博客根目录的 <code>_config.yml</code> 文件（Hexo 主配置文件）：</li>
</ol>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">open _config.yml</span><br></pre></td></tr></table></figure>

<p>拉到文件末尾，找到或新增 <code>deploy</code> 节点，添加以下配置（替换为你的信息）：</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">deploy:</span></span><br><span class="line">  <span class="attr">type:</span> <span class="string">git</span>  <span class="comment"># 部署类型：Git</span></span><br><span class="line">  <span class="attr">repo:</span> <span class="string">https://github.com/你的GitHub用户名/你的GitHub用户名.github.io.git</span>  <span class="comment"># 复制的仓库地址</span></span><br><span class="line">  <span class="attr">branch:</span> <span class="string">main</span>  <span class="comment"># 部署分支（GitHub Pages 默认 main 分支）</span></span><br><span class="line">  <span class="attr">message:</span> <span class="string">"Hexo deploy: <span class="template-variable">&#123;&#123; now('YYYY-MM-DD HH:mm:ss') &#125;&#125;</span>"</span>  <span class="comment"># 自动添加部署时间（可选）</span></span><br></pre></td></tr></table></figure>

<ul>
<li>注意：YAML 格式要求冒号后面必须加空格！</li>
</ul>
<h3 id="3-执行部署命令"><a href="#3-执行部署命令" class="headerlink" title="3. 执行部署命令"></a>3. 执行部署命令</h3><p>配置完成后，在博客根目录按以下顺序执行：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 1. 清理缓存</span></span><br><span class="line">hexo clean</span><br><span class="line"></span><br><span class="line"><span class="comment"># 2. 生成最新静态文件</span></span><br><span class="line">hexo g</span><br><span class="line"></span><br><span class="line"><span class="comment"># 3. 推送部署到 GitHub（核心命令）</span></span><br><span class="line">hexo d  <span class="comment"># 或 hexo deploy</span></span><br></pre></td></tr></table></figure>

<h4 id="部署成功标志"><a href="#部署成功标志" class="headerlink" title="部署成功标志"></a>部署成功标志</h4><p>终端输出以下信息且无报错：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">INFO  Deploying: git</span><br><span class="line">INFO  Clearing .deploy_git folder...</span><br><span class="line">INFO  Copying files from public folder...</span><br><span class="line">INFO  Commit with message: Hexo deploy: 2025-11-05 16:30:00</span><br><span class="line">INFO  Pushing to https://github.com/xxx/xxx.github.io.git</span><br><span class="line">INFO  Deploy done: git</span><br></pre></td></tr></table></figure>

<h3 id="4-访问线上博客"><a href="#4-访问线上博客" class="headerlink" title="4. 访问线上博客"></a>4. 访问线上博客</h3><p>部署成功后，等待 1-5 分钟，浏览器访问 <code>https://你的GitHub用户名.github.io</code>（如 <code>https://xxx.github.io</code>），即可看到线上博客。</p>
<hr>
<h2 id="五、常见问题排查"><a href="#五、常见问题排查" class="headerlink" title="五、常见问题排查"></a>五、常见问题排查</h2><h3 id="1-终端提示-“command-not-found-hexo”"><a href="#1-终端提示-“command-not-found-hexo”" class="headerlink" title="1. 终端提示 “command not found: hexo”"></a>1. 终端提示 “command not found: hexo”</h3><ul>
<li>原因：环境变量配置错误或未生效</li>
<li>解决：重新执行 <code>source ~/.zshrc</code>，或检查 <code>~/.zshrc</code> 中路径是否为 <code>/opt/homebrew/bin</code></li>
</ul>
<h3 id="2-hexo-d-报错-“No-repository-defined”"><a href="#2-hexo-d-报错-“No-repository-defined”" class="headerlink" title="2. hexo d 报错 “No repository defined”"></a>2. <code>hexo d</code> 报错 “No repository defined”</h3><ul>
<li>原因：<code>_config.yml</code> 中 <code>deploy</code> 节点的 <code>repo</code> 地址未配置或格式错误</li>
<li>解决：检查 <code>repo</code> 地址是否正确（含 <code>.git</code> 后缀），确保冒号后加空格</li>
</ul>
<h3 id="3-部署成功后访问-404"><a href="#3-部署成功后访问-404" class="headerlink" title="3. 部署成功后访问 404"></a>3. 部署成功后访问 404</h3><ul>
<li>检查 GitHub 仓库名是否为 <code>用户名.github.io</code>（严格区分大小写）</li>
<li>进入仓库「Settings → Pages」，确认部署分支为 <code>main</code> 且状态为「已启用」</li>
</ul>
<h3 id="4-推送时权限不足"><a href="#4-推送时权限不足" class="headerlink" title="4. 推送时权限不足"></a>4. 推送时权限不足</h3><ul>
<li>方案 1：改用 SSH 地址部署（需提前配置 GitHub SSH 密钥）</li>
<li>方案 2：HTTPS 地址部署时，输入 GitHub 个人访问令牌（替代密码），令牌需勾选 <code>repo</code> 权限</li>
</ul>
<hr>
<h2 id="六、总结"><a href="#六、总结" class="headerlink" title="六、总结"></a>六、总结</h2><h3 id="1-核心流程"><a href="#1-核心流程" class="headerlink" title="1. 核心流程"></a>1. 核心流程</h3><p>安装 Node.js → 安装 Hexo → 配置环境变量 → 本地预览 → 线上部署</p>
<h3 id="2-常用命令速查"><a href="#2-常用命令速查" class="headerlink" title="2. 常用命令速查"></a>2. 常用命令速查</h3><table>
<thead>
<tr>
<th>功能</th>
<th>命令</th>
</tr>
</thead>
<tbody><tr>
<td>初始化博客</td>
<td><code>hexo init 博客名</code></td>
</tr>
<tr>
<td>清理缓存</td>
<td><code>hexo clean</code></td>
</tr>
<tr>
<td>生成静态文件</td>
<td><code>hexo g</code>（全称 <code>hexo generate</code>）</td>
</tr>
<tr>
<td>本地预览</td>
<td><code>hexo s</code>（全称 <code>hexo server</code>）</td>
</tr>
<tr>
<td>线上部署</td>
<td><code>hexo d</code>（全称 <code>hexo deploy</code>）</td>
</tr>
<tr>
<td>一键部署</td>
<td><code>hexo clean &amp;&amp; hexo g &amp;&amp; hexo d</code></td>
</tr>
</tbody></table>
<hr>
<blockquote>
<p>说明：按本文步骤操作后，即可实现 Hexo 博客的本地开发预览和线上公开访问。如需部署到 Gitee Pages、Netlify 等其他平台，可参考对应平台的仓库配置规则修改 <code>_config.yml</code> 中的 <code>deploy</code> 节点。</p>
</blockquote>
<p>plaintext</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">验证文件有效性</span><br><span class="line">生成 `.md` 文件后，可通过以下方式确认：</span><br><span class="line">1. 用 Typora、VS Code（安装 Markdown 插件）、Obsidian 等编辑器打开</span><br><span class="line">2. 查看格式：标题层级、代码块高亮、表格、列表是否正常显示</span><br><span class="line">3. 所有命令可直接复制使用，无需额外修改</span><br><span class="line"></span><br><span class="line">按上面的方法操作，你会得到一个 **标准、可编辑、可分享** 的 `.md` 文档，完全满足下载使用的需求～</span><br></pre></td></tr></table></figure>

      
    </div>
    <footer class="article-footer">
      
        <a data-url="https://kziwws.github.io/2023/01/06/technology20230106110520/" data-id="cmhm05vy2007op4jj7a7e7rwr" class="article-share-link" data-share="baidu" data-title="Hexo文章上传指令操作">分享到</a>
      

    
  <a href="https://kziwws.github.io/2023/01/06/technology20230106110520/#valine_thread" class="article-comment-link">评论</a>


      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/cocosCreator/" rel="tag">cocosCreator</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/technology/" rel="tag">technology</a></li></ul>

    </footer>
  </div>
  
</article>

  
    <article id="post-poetry20221016194425" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2022/10/16/poetry20221016194425/" class="article-date">
  <time datetime="2022-10-16T11:44:25.000Z" itemprop="datePublished">2022-10-16</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/%E8%AF%97/">诗</a>►<a class="article-category-link" href="/categories/%E8%AF%97/%E8%AF%97%E8%AF%8D/">诗词</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2022/10/16/poetry20221016194425/">《叹平生》</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>烟花划过夜空<br>迷失了影踪<br>你却说那是逐行苍穹<br>愿来世可以化作星弓<br>守护你晨饮朝露夜伴晚风<br>化成高墙倔强黯然成伤<br>千载梦 万般空<br>百转柔肠 路在消亡<br>诗与行囊身寄他乡<br>容与鬓斑记忆犹长<br>天涯敢闯荆棘万方<br>想要理想还是追寻你的航向奔向远方<br>不知道被这棉被裹住身体会不会有时候感受不到温凉<br>不知道在黑暗的角落是否有陌生人倾泪悲伤<br>不知道在这更替的夜里是否又有人坦荡<br>心有万人肠 何来人间转辗一趟？</p>
<p>by:霜</p>

      
    </div>
    <footer class="article-footer">
      
        <a data-url="https://kziwws.github.io/2022/10/16/poetry20221016194425/" data-id="cmhm05vxx005bp4jjb1d553hy" class="article-share-link" data-share="baidu" data-title="《叹平生》">分享到</a>
      

    
  <a href="https://kziwws.github.io/2022/10/16/poetry20221016194425/#valine_thread" class="article-comment-link">评论</a>


      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/poetry/" rel="tag">poetry</a></li></ul>

    </footer>
  </div>
  
</article>

  
    <article id="post-technology20221016191405" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2022/10/16/technology20221016191405/" class="article-date">
  <time datetime="2022-10-16T11:14:05.000Z" itemprop="datePublished">2022-10-16</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/python/">python</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2022/10/16/technology20221016191405/">Pycharm2021破解版安装教程</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h5 id="PyCharm是一种-Python-IDE-，带有一整套可以帮助用户在使用-Python-语言开发时提高其效率的工具，比如-调试-、-语法高亮-、-项目管理-、代码跳转、智能提示、-自动完成-、-单元测试-、-版本控制-。此外，该IDE提供了一些高级功能，以用于支持Django框架下的专业开发。"><a href="#PyCharm是一种-Python-IDE-，带有一整套可以帮助用户在使用-Python-语言开发时提高其效率的工具，比如-调试-、-语法高亮-、-项目管理-、代码跳转、智能提示、-自动完成-、-单元测试-、-版本控制-。此外，该IDE提供了一些高级功能，以用于支持Django框架下的专业开发。" class="headerlink" title="PyCharm是一种[Python][IDE]，带有一整套可以帮助用户在使用[Python]语言开发时提高其效率的工具，比如[调试]、[语法高亮]、[项目管理]、代码跳转、智能提示、[自动完成]、[单元测试]、[版本控制]=。此外，该IDE提供了一些高级功能，以用于支持Django框架下的专业开发。"></a>PyCharm是一种[Python][IDE]，带有一整套可以帮助用户在使用[Python]语言开发时提高其效率的工具，比如[调试]、[语法高亮]、[项目管理]、代码跳转、智能提示、[自动完成]、[单元测试]、[版本控制]=。此外，该IDE提供了一些高级功能，以用于支持<a href="https://baike.baidu.com/item/Django/61531?fromModule=lemma_inlink" target="_blank" rel="noopener">Django</a>框架下的专业开发。</h5><h4 id="准备工作"><a href="#准备工作" class="headerlink" title="准备工作"></a>准备工作</h4><p><strong>一、下载破解补丁</strong></p>
<p>下载激活所需的补丁文件，由于分享的百度网盘链接容易被封，给两个下载地址如果被删除，请换第二个，两个地址内容是一样的。</p>
<p>网盘链接一: <a href="https://pan.baidu.com/s/1GsWqGh71ksF4ahOb7sW4Kg?pwd=0q75" target="_blank" rel="noopener">https://pan.baidu.com/s/1GsWqGh71ksF4ahOb7sW4Kg?pwd=0q75</a>  提取码: 0q75</p>
<p>网盘链接二: <a href="https://pan.baidu.com/s/13V22JJ_oLBlkSp97Tz1ZFA" target="_blank" rel="noopener">https://pan.baidu.com/s/13V22JJ_oLBlkSp97Tz1ZFA</a>  提取码: g3b9</p>
<p><strong>二、下载PyCharm版本 2022.2</strong></p>
<p>开始下载: <a href="https://download.jetbrains.com.cn/python/pycharm-professional-2022.2.4.dmg?_gl=1*19zhtw1*_ga*NDk0MTY4MjMwLjE2Mzk1NTExMzU.*_ga_9J976DJZ68*MTY3MzQyNjA1NS40LjEuMTY3MzQyNjA2Mi41My4wLjA.&_ga=2.215991511.1740996901.1673343243-494168230.1639551135" target="_blank" rel="noopener">Mac PyCharm2022 Community版</a> </p>
<p>开始下载: <a href="https://download.jetbrains.com.cn/python/pycharm-community-2022.2.4.dmg?_gl=1*19zhtw1*_ga*NDk0MTY4MjMwLjE2Mzk1NTExMzU.*_ga_9J976DJZ68*MTY3MzQyNjA1NS40LjEuMTY3MzQyNjA2Mi41My4wLjA.&_ga=2.215991511.1740996901.1673343243-494168230.1639551135" target="_blank" rel="noopener">Mac PyCharm2022 Professional版</a> </p>
<p>下载其他版本<a href="https://www.jetbrains.com/pycharm/download/other.html" target="_blank" rel="noopener">https://www.jetbrains.com/pycharm/download/other.html</a></p>
<p>上面的布丁是破解PyCharm 2022版本，其他也可以自行尝试。</p>
<p><strong><em>1、在 PyCharm 官网下载安装包并且安装在自己电脑上</em></strong></p>
<p><strong><em>2、如果你电脑上的PyCharm之前就使用过其他激活教程，那么我建议你先重置你的PyCharm。这样能避免因为以前的激活补丁而导致永久激活失败，后期失效了又得折腾是很麻烦的。</em></strong>（Ps：新电脑新安装的PyCharm无需重置，可以直接跳过这一步直接开始激活。）</p>
<p>重置： 在补丁文件中打开<code>重置脚本</code>这个文件夹</p>
<p><img src="http://www.javatiku.cn/usr/img/09978955f2a65748e5c280634695a8f0.png" alt="重置1.png"></p>
<p><code>.sh</code>结尾的是Mac端执行的脚本文件 <code>.vbs</code>是windows执行的脚本</p>
<p>windows 双击运行脚本就重置好了。mac端 需要</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo su</span><br></pre></td></tr></table></figure>

<p> 在命令行终端中找到那个文件所在的目录，执行</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">./reset_jetbrains_eval_mac_linux.sh</span><br></pre></td></tr></table></figure>

<p>在执行中可能会报错</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sh: .&#x2F;reset_jetbrains_eval_mac_linux.sh: Permission denied</span><br></pre></td></tr></table></figure>

<p>这是因为用户没有权限，而导致无法执行。用命令chmod 修改一下bin目录下的.sh权限就可以了。</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">chmod u+x *.sh</span><br></pre></td></tr></table></figure>

<p>这里的u 这里指文件所有者，+x 添加可执行权限，.sh表示所有的sh文件</p>
        
          <p class="article-more-link">
            <a href="/2022/10/16/technology20221016191405/#more">Read More</a>
          </p>
        
      
    </div>
    <footer class="article-footer">
      
        <a data-url="https://kziwws.github.io/2022/10/16/technology20221016191405/" data-id="cmhm05vy1007ap4jjcztuevj3" class="article-share-link" data-share="baidu" data-title="Pycharm2021破解版安装教程">分享到</a>
      

    
  <a href="https://kziwws.github.io/2022/10/16/technology20221016191405/#valine_thread" class="article-comment-link">评论</a>


      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/python/" rel="tag">python</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/technology/" rel="tag">technology</a></li></ul>

    </footer>
  </div>
  
</article>

  
    <article id="post-technology20221012070215" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2022/10/12/technology20221012070215/" class="article-date">
  <time datetime="2022-10-11T23:02:15.000Z" itemprop="datePublished">2022-10-12</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/flutter/">flutter</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2022/10/12/technology20221012070215/">使用fvm管理Flutter SDK版本</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="介绍"><a href="#介绍" class="headerlink" title="介绍"></a>介绍</h3><p>fvm是一个非常有用的工具，可以帮助我们在Flutter项目中管理不同版本的Flutter SDK。使用fvm，我们可以轻松切换和管理项目所使用的Flutter SDK版本。</p>
<h3 id="步骤"><a href="#步骤" class="headerlink" title="步骤"></a>步骤</h3><p>以下是使用fvm的步骤：</p>
<p>安装fvm：打开终端并运行以下命令来安装fvm：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pub global activate fvm</span><br></pre></td></tr></table></figure>

<ol>
<li>创建一个新的Flutter项目：使用<code>flutter create</code>命令创建一个新的Flutter项目，或者进入到一个已经存在的Flutter项目目录。</li>
<li>初始化fvm：在终端中导航到你的Flutter项目目录，并运行以下命令来初始化fvm：</li>
</ol>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">fvm init</span><br></pre></td></tr></table></figure>

<p>列出可用的Flutter版本：运行以下命令来列出所有可用的Flutter SDK版本：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">fvm list-remote</span><br></pre></td></tr></table></figure>

<p>安装特定版本的Flutter SDK：从列表中选择一个你想要的版本号，并运行以下命令来安装该版本的Flutter SDK：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">fvm install &lt;version&gt;</span><br></pre></td></tr></table></figure>

<p>确保将<code>&lt;version&gt;</code>替换为你想要安装的实际版本号。</p>
<p>例如安装 <code>3.0.0-stable</code>  fvm install 3.0.0-stable ，如何安装失败报错，先再次尝试运行改命令。</p>
<p>关联项目到特定版本的Flutter SDK：通过以下命令将你的项目关联到已安装的特定版本的Flutter SDK：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">fvm use &lt;version&gt;</span><br></pre></td></tr></table></figure>

<p>确保将<code>&lt;version&gt;</code>替换为你实际安装的版本号，例如使用 <code>3.0.0-stable</code>  fvm use 3.0.0-stable 。</p>
<p>在项目中使用fvm：现在，你的Flutter项目已经和特定版本的Flutter SDK关联起来了。可以使用以下命令来运行Flutter命令，例如运行应用程序：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">fvm flutter run</span><br></pre></td></tr></table></figure>

<p>查询当前使用的版本：要查询当前项目所使用的Flutter SDK版本，请运行以下命令：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">fvm current</span><br></pre></td></tr></table></figure>
        
          <p class="article-more-link">
            <a href="/2022/10/12/technology20221012070215/#more">Read More</a>
          </p>
        
      
    </div>
    <footer class="article-footer">
      
        <a data-url="https://kziwws.github.io/2022/10/12/technology20221012070215/" data-id="cmhm05vy10075p4jj2by129w9" class="article-share-link" data-share="baidu" data-title="使用fvm管理Flutter SDK版本">分享到</a>
      

    
  <a href="https://kziwws.github.io/2022/10/12/technology20221012070215/#valine_thread" class="article-comment-link">评论</a>


      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/flutter/" rel="tag">flutter</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/technology/" rel="tag">technology</a></li></ul>

    </footer>
  </div>
  
</article>

  


  <nav id="page-nav">
    <span class="page-number current">1</span><a class="page-number" href="/page/2/">2</a><a class="page-number" href="/page/3/">3</a><span class="space">&hellip;</span><a class="page-number" href="/page/8/">8</a><a class="extend next" rel="next" href="/page/2/">下一页</a>
  </nav>
</section>
      
      <aside id="sidebar">
  
    
<div class="widget-wrap">
  <h3 class="widget-title">关于</h3>
  <ul class="widget about-me">
    
    <li><img class="author" title="About me" src="/img/github.png" /></li>
    
    
    <li ><font color="#424242" size="2em">苹果应用软件开发 & 游戏软件开发</font></li>
    
    <li ><font color="#424242" size="2em">email: ggb.chen@foxmail.com</font></li>
    
  </ul>
</div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">分类</h3>
    <div class="widget">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/charles/">charles</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/cocoapods/">cocoapods</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/cocosCreator/">cocosCreator</a><span class="category-list-count">8</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/error/">error</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/flutter/">flutter</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/git/">git</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/hexo/">hexo</a><span class="category-list-count">5</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/ios/">ios</a><span class="category-list-count">4</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/knowledge/">knowledge</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/python/">python</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/regexp/">regexp</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E8%AF%97/">诗</a><span class="category-list-count">46</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/%E8%AF%97/%E8%AF%97%E6%AD%8C/">诗歌</a><span class="category-list-count">9</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E8%AF%97/%E8%AF%97%E8%AF%8D/">诗词</a><span class="category-list-count">23</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E8%AF%97/%E8%BD%AC%E5%BD%95/">转录</a><span class="category-list-count">1</span></li></ul></li></ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">标签</h3>
    <div class="widget">
      <ul class="tag-list" itemprop="keywords"><li class="tag-list-item"><a class="tag-list-link" href="/tags/android/" rel="tag">android</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/cocoapods/" rel="tag">cocoapods</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/cocosCreator/" rel="tag">cocosCreator</a><span class="tag-list-count">8</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/flutter/" rel="tag">flutter</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/git/" rel="tag">git</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hexo/" rel="tag">hexo</a><span class="tag-list-count">6</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ios/" rel="tag">ios</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/knowledge/" rel="tag">knowledge</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mac/" rel="tag">mac</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/poetry/" rel="tag">poetry</a><span class="tag-list-count">46</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/python/" rel="tag">python</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/regexp/" rel="tag">regexp</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/technology/" rel="tag">technology</a><span class="tag-list-count">29</span></li></ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">标签云</h3>
    <div class="widget tagcloud">
      <a href="/tags/android/" style="font-size: 11.67px;">android</a> <a href="/tags/cocoapods/" style="font-size: 10px;">cocoapods</a> <a href="/tags/cocosCreator/" style="font-size: 16.67px;">cocosCreator</a> <a href="/tags/flutter/" style="font-size: 11.67px;">flutter</a> <a href="/tags/git/" style="font-size: 10px;">git</a> <a href="/tags/hexo/" style="font-size: 15px;">hexo</a> <a href="/tags/ios/" style="font-size: 13.33px;">ios</a> <a href="/tags/knowledge/" style="font-size: 10px;">knowledge</a> <a href="/tags/mac/" style="font-size: 10px;">mac</a> <a href="/tags/poetry/" style="font-size: 20px;">poetry</a> <a href="/tags/python/" style="font-size: 13.33px;">python</a> <a href="/tags/regexp/" style="font-size: 10px;">regexp</a> <a href="/tags/technology/" style="font-size: 18.33px;">technology</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">归档</h3>
    <div class="widget">
      <!--<ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2025/11/">十一月 2025</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2023/09/">九月 2023</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2023/03/">三月 2023</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2023/02/">二月 2023</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2023/01/">一月 2023</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2022/10/">十月 2022</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2022/09/">九月 2022</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2022/01/">一月 2022</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/12/">十二月 2021</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/10/">十月 2021</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/08/">八月 2021</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/11/">十一月 2020</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/05/">五月 2020</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/04/">四月 2020</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/03/">三月 2020</a><span class="archive-list-count">15</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/02/">二月 2020</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/01/">一月 2020</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/12/">十二月 2019</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/10/">十月 2019</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/09/">九月 2019</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/08/">八月 2019</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/07/">七月 2019</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/06/">六月 2019</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/05/">五月 2019</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/03/">三月 2019</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/01/">一月 2019</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/12/">十二月 2018</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/11/">十一月 2018</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/08/">八月 2018</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/07/">七月 2018</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/06/">六月 2018</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/03/">三月 2018</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/02/">二月 2018</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/01/">一月 2018</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/06/">六月 2017</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/12/">十二月 2015</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/02/">二月 2015</a><span class="archive-list-count">5</span></li></ul> -->
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2025/11/">2025年</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2023/09/">2023年</a><span class="archive-list-count">6</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2022/10/">2022年</a><span class="archive-list-count">5</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/12/">2021年</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/11/">2020年</a><span class="archive-list-count">26</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/12/">2019年</a><span class="archive-list-count">13</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/12/">2018年</a><span class="archive-list-count">14</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/06/">2017年</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/12/">2015年</a><span class="archive-list-count">6</span></li></ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">近期文章</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2025/11/05/technology20251105090825/">Sudoku Game Privacy Policy_ Zero Personal Data Collection, Pure Gaming Experience</a>
          </li>
        
          <li>
            <a href="/2023/09/10/technology20230910111821/">Hexo博客部署常见问题及解决方案</a>
          </li>
        
          <li>
            <a href="/2023/03/14/technology20230314101225/">利用python脚本拆解游戏中的图集资源</a>
          </li>
        
          <li>
            <a href="/2023/02/10/technology20230210090112/">利用jekenis自动打包上传阿里云下载和通知钉钉机器人</a>
          </li>
        
          <li>
            <a href="/2023/01/21/technology20230121151206/">IOS项目脚本自动化批量打包并上传第三方平台</a>
          </li>
        
      </ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">友情链接</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="https://github.com/kziwws" target="_blank">github</a>
          </li>
        
          <li>
            <a href="https://shevakuilin.com" target="_blank">shevakuilin</a>
          </li>
        
          <li>
            <a href="https://hans2936.github.io" target="_blank">hans2936</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
      
    </div>
    <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2015 <a href="https://github.com/kziwws" target="_blank">kziwws</a> 
      Powered by hexo,Theme by landscape-plus.
    </div>
    <div id="footer-info" class="inner">
      本站博客采用 <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/cn/" target="_blank">[知识共享署名-非商业性使用-相同方式共享 3.0 中国大陆许可协议]</a> 进行许可
    </div>
  </div>
</footer>


<!--
<div id="footer-info" class="inner">
     &copy; 2025 kziwws<br>
      Powered by <a href="//hexo.io/" target="_blank">Hexo</a>
     .
     Theme by <a href="https://github.com/xiangming/landscape-plus" target="_blank">Landscape-plus</a>
   </div>
</div>
-->
  </div>
  <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">首页</a>
  
    <a href="/tags/technology" class="mobile-nav-link">编程技术</a>
  
    <a href="/tags/poetry" class="mobile-nav-link">诗</a>
  
    <a href="/tags/life" class="mobile-nav-link">生活随笔</a>
  
    <a href="/archives" class="mobile-nav-link">所有文章</a>
  
</nav>
  <!-- totop start -->
<div id="totop">
<a title="返回顶部"><img src="/img/scrollup.png"/></a>
</div>

<!-- totop end -->

<!--载入js，在</body>之前插入即可-->
    <!--Leancloud 操作库:-->
    <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
    <!--Valine 的核心代码库-->
    <script src="/js/Valine.min.js"></script>
    <script>
        new Valine({
            av: AV, 
            el: '.comment',
            app_id: 'zh2N00Qk2UIsu1N8Qfu468TH-gzGzoHsz',
            app_key: 'BJrjTSEoKMfc05OMLWhCzmHk',
            placeholder: '想说点什么...',
            pageSize: 15,
            notify: false,
            verify: false,
        });
    </script>


<!-- 百度分享 start -->

<div id="article-share-box" class="article-share-box">
  <div id="bdshare" class="bdsharebuttonbox article-share-links">
    <a class="article-share-weibo" data-cmd="tsina" title="分享到新浪微博"></a>
    <a class="article-share-weixin" data-cmd="weixin" title="分享到微信"></a>
    <a class="article-share-qq" data-cmd="sqq" title="分享到QQ"></a>
    <a class="article-share-renren" data-cmd="renren" title="分享到人人网"></a>
    <a class="article-share-more" data-cmd="more" title="更多"></a>
  </div>
</div>
<script>
  function SetShareData(cmd, config) {
    if (shareDataTitle && shareDataUrl) {
      config.bdText = shareDataTitle;
      config.bdUrl = shareDataUrl;
    }
    return config;
  }
  window._bd_share_config={
    "common":{onBeforeClick: SetShareData},
    "share":{"bdCustomStyle":"/css/bdshare.css"}
  };
  with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='//bdimg.share.baidu.com/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)];
</script>

<!-- 百度分享 end -->

<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>


  
<link rel="stylesheet" href="/fancybox/jquery.fancybox.css">

  
<script src="/fancybox/jquery.fancybox.pack.js"></script>




<! -- mathjax config similar to math.stackexchange -->

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
                processEscapes: true
                    
}
  
        });
</script>

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
            skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
                  
}
    
        });
</script>

<script type="text/x-mathjax-config">
MathJax.Hub.Queue(function() {
            var all = MathJax.Hub.getAllJax(), i;
            for(i=0; i < all.length; i += 1) {
                            all[i].SourceElement().parentNode.className += ' has-jax';
                                    
            }
                
        });
</script>

<script type="text/javascript" src="//cdn.bootcss.com/mathjax/2.5.3/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>



<script src="/js/script.js"></script>


</div>

  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    var isXml = true;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length === 0) {
      search_path = "search.xml";
    } else if (/json$/i.test(search_path)) {
      isXml = false;
    }
    var path = "/" + search_path;
    // monitor main search box;

    var onPopupClose = function (e) {
      $('.popup').hide();
      $('#local-search-input').val('');
      $('.search-result-list').remove();
      $('#no-result').remove();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    }

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.search-popup-overlay').click(onPopupClose);
      $('.popup').toggle();
      var $localSearchInput = $('#local-search-input');
      $localSearchInput.attr("autocapitalize", "none");
      $localSearchInput.attr("autocorrect", "off");
      $localSearchInput.focus();
    }

    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';

      // start loading animation
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay">' +
          '<div id="search-loading-icon">' +
          '<i class="icon-search"></i>' +
          '</div>' +
          '</div>')
        .css('overflow', 'hidden');
      $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');

      $.ajax({
        url: path,
        dataType: isXml ? "xml" : "json",
        async: true,
        success: function(res) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.local-search-inner');
          var datas = isXml ? $("entry", res).map(function() {
            return {
              title: $("title", this).text(),
              content: $("content",this).text(),
              url: $("url" , this).text()
            };
          }).get() : res;
          var input = document.getElementById(search_id);
          var resultContent = document.getElementById(content_id);
          var inputEventFunction = function() {
            var searchText = input.value.trim().toLowerCase();
            var keywords = searchText.split(/[\s\-]+/);
            if (keywords.length > 1) {
              keywords.push(searchText);
            }
            var resultItems = [];
            if (searchText.length > 0) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var hitCount = 0;
                var searchTextCount = 0;
                var title = data.title.trim();
                var titleInLowerCase = title.toLowerCase();
                var content = data.content.trim().replace(/<[^>]+>/g,"");
                var contentInLowerCase = content.toLowerCase();
                var articleUrl = decodeURIComponent(data.url);
                var indexOfTitle = [];
                var indexOfContent = [];
                // only match articles with not empty titles
                if(title != '') {
                  keywords.forEach(function(keyword) {
                    function getIndexByWord(word, text, caseSensitive) {
                      var wordLen = word.length;
                      if (wordLen === 0) {
                        return [];
                      }
                      var startPosition = 0, position = [], index = [];
                      if (!caseSensitive) {
                        text = text.toLowerCase();
                        word = word.toLowerCase();
                      }
                      while ((position = text.indexOf(word, startPosition)) > -1) {
                        index.push({position: position, word: word});
                        startPosition = position + wordLen;
                      }
                      return index;
                    }

                    indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
                    indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
                  });
                  if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
                    isMatch = true;
                    hitCount = indexOfTitle.length + indexOfContent.length;
                  }
                }

                // show search results

                if (isMatch) {
                  // sort index by position of keyword

                  [indexOfTitle, indexOfContent].forEach(function (index) {
                    index.sort(function (itemLeft, itemRight) {
                      if (itemRight.position !== itemLeft.position) {
                        return itemRight.position - itemLeft.position;
                      } else {
                        return itemLeft.word.length - itemRight.word.length;
                      }
                    });
                  });

                  // merge hits into slices

                  function mergeIntoSlice(text, start, end, index) {
                    var item = index[index.length - 1];
                    var position = item.position;
                    var word = item.word;
                    var hits = [];
                    var searchTextCountInSlice = 0;
                    while (position + word.length <= end && index.length != 0) {
                      if (word === searchText) {
                        searchTextCountInSlice++;
                      }
                      hits.push({position: position, length: word.length});
                      var wordEnd = position + word.length;

                      // move to next position of hit

                      index.pop();
                      while (index.length != 0) {
                        item = index[index.length - 1];
                        position = item.position;
                        word = item.word;
                        if (wordEnd > position) {
                          index.pop();
                        } else {
                          break;
                        }
                      }
                    }
                    searchTextCount += searchTextCountInSlice;
                    return {
                      hits: hits,
                      start: start,
                      end: end,
                      searchTextCount: searchTextCountInSlice
                    };
                  }

                  var slicesOfTitle = [];
                  if (indexOfTitle.length != 0) {
                    slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
                  }

                  var slicesOfContent = [];
                  while (indexOfContent.length != 0) {
                    var item = indexOfContent[indexOfContent.length - 1];
                    var position = item.position;
                    var word = item.word;
                    // cut out 100 characters
                    var start = position - 20;
                    var end = position + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if (end < position + word.length) {
                      end = position + word.length;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
                  }

                  // sort slices in content by search text's count and hits' count

                  slicesOfContent.sort(function (sliceLeft, sliceRight) {
                    if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
                      return sliceRight.searchTextCount - sliceLeft.searchTextCount;
                    } else if (sliceLeft.hits.length !== sliceRight.hits.length) {
                      return sliceRight.hits.length - sliceLeft.hits.length;
                    } else {
                      return sliceLeft.start - sliceRight.start;
                    }
                  });

                  // select top N slices in content
                  
                  var upperBound = parseInt('-1');
                  if (upperBound >= 0) {
                    slicesOfContent = slicesOfContent.slice(0, upperBound);
                  }

                  // highlight title and content

                  function highlightKeyword(text, slice) {
                    var result = '';
                    var prevEnd = slice.start;
                    slice.hits.forEach(function (hit) {
                      result += text.substring(prevEnd, hit.position);
                      var end = hit.position + hit.length;
                      result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
                      prevEnd = end;
                    });
                    result += text.substring(prevEnd, slice.end);
                    return result;
                  }

                  var resultItem = '';

                  if (slicesOfTitle.length != 0) {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
                  } else {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
                  }

                  slicesOfContent.forEach(function (slice) {
                    resultItem += "<a href='" + articleUrl + "'>" +
                      "<p class=\"search-result\">" + highlightKeyword(content, slice) +
                      "...</p>" + "</a>";
                  });

                  resultItem += "</li>";
                  resultItems.push({
                    item: resultItem,
                    searchTextCount: searchTextCount,
                    hitCount: hitCount,
                    id: resultItems.length
                  });
                }
              })
            };
            if (keywords.length === 1 && keywords[0] === "") {
              resultContent.innerHTML = '<div id="no-result"><span id="icon-search"></span></div>'
            } else if (resultItems.length === 0) {
              resultContent.innerHTML = '<div id="no-result"><span id="icon-frown"></span></div>'
            } else {
              resultItems.sort(function (resultLeft, resultRight) {
                if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
                  return resultRight.searchTextCount - resultLeft.searchTextCount;
                } else if (resultLeft.hitCount !== resultRight.hitCount) {
                  return resultRight.hitCount - resultLeft.hitCount;
                } else {
                  return resultRight.id - resultLeft.id;
                }
              });
              var searchResultList = '<ul class=\"search-result-list\">';
              resultItems.forEach(function (result) {
                searchResultList += result.item;
              })
              searchResultList += "</ul>";
              resultContent.innerHTML = searchResultList;
            }
          }
          
          if ('auto' === 'auto') {
            input.addEventListener('input', inputEventFunction);
          } else {
            $('.search-icon').click(inputEventFunction);
            input.addEventListener('keypress', function (event) {
              if (event.keyCode === 13) {
                inputEventFunction();
              }
            });
          }

          // remove loading animation
          $(".local-search-pop-overlay").remove();
          $('body').css('overflow', '');

          proceedsearch();
        }
      });
    }

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched === false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(onPopupClose);
    $('.popup').click(function(e){
      e.stopPropagation();
    });
    $(document).on('keyup', function (event) {
      var shouldDismissSearchPopup = event.which === 27 &&
        $('.search-popup').is(':visible');
      if (shouldDismissSearchPopup) {
        onPopupClose();
      }
    });
  </script>
</body>
</html>

